]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
overview: Do not warp pointer to fake crossing event
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 27 Nov 2018 12:36:26 +0000 (13:36 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Wed, 30 Jan 2019 21:50:01 +0000 (22:50 +0100)
This is actually papering over bugs in toolkits. On X11 the Xserver will
send crossing events when the stage input shape changes. As those go
end up ignored in GTK+, this warp call aims (and randomly manages) to send
a motion event that wouldn't go unlistened by the drag source window (the
one holding the grab).

This bug actually manifests in other ways, eg. by changing the window
beneath the pointer with alt-tab while DnDing. This should be fixed
altogether in the client side.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/317

js/ui/overview.js

index ae60e1a240eb36e979b97a69b910c607a1beb2c1..e92b21e50e9a633cc6b5d8d7f796b896d6aae366 100644 (file)
@@ -2,13 +2,11 @@
 
 const Clutter = imports.gi.Clutter;
 const GLib = imports.gi.GLib;
-const Gtk = imports.gi.Gtk;
 const Meta = imports.gi.Meta;
 const Mainloop = imports.mainloop;
 const Signals = imports.signals;
 const St = imports.gi.St;
 const Shell = imports.gi.Shell;
-const Gdk = imports.gi.Gdk;
 
 const Background = imports.ui.background;
 const DND = imports.ui.dnd;
@@ -158,7 +156,6 @@ var Overview = class {
         this._windowSwitchTimestamp = 0;
         this._lastActiveWorkspaceIndex = -1;
         this._lastHoveredWindow = null;
-        this._needsFakePointerEvent = false;
 
         if (this._initCalled)
             this.init();
@@ -306,19 +303,9 @@ var Overview = class {
         if (this._windowSwitchTimeoutId != 0) {
             Mainloop.source_remove(this._windowSwitchTimeoutId);
             this._windowSwitchTimeoutId = 0;
-            this._needsFakePointerEvent = false;
         }
     }
 
-    _fakePointerEvent() {
-        let display = Gdk.Display.get_default();
-        let deviceManager = display.get_device_manager();
-        let pointer = deviceManager.get_client_pointer();
-        let [gdkScreen, pointerX, pointerY] = pointer.get_position();
-
-        pointer.warp(gdkScreen, pointerX, pointerY);
-    }
-
     _onDragMotion(dragEvent) {
         let targetIsWindow = dragEvent.targetActor &&
                              dragEvent.targetActor._delegate &&
@@ -340,7 +327,6 @@ var Overview = class {
             this._windowSwitchTimeoutId = Mainloop.timeout_add(DND_WINDOW_SWITCH_TIMEOUT,
                 () => {
                     this._windowSwitchTimeoutId = 0;
-                    this._needsFakePointerEvent = true;
                     Main.activateWindow(dragEvent.targetActor._delegate.metaWindow,
                                         this._windowSwitchTimestamp);
                     this.hide();
@@ -643,12 +629,6 @@ var Overview = class {
             Main.layoutManager.hideOverview();
 
         this._syncGrab();
-
-        // Fake a pointer event if requested
-        if (this._needsFakePointerEvent) {
-            this._fakePointerEvent();
-            this._needsFakePointerEvent = false;
-        }
     }
 
     toggle() {